From: Claudio Cambra Date: Thu, 5 Dec 2024 07:49:38 +0000 (+0800) Subject: mac-crafter: Check if path to trecursively codesign exists and throw error if it... X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~30^2^2~208^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f3e4fe984602db1dbf0fd6ce6375a5e2ad403b77;p=nextcloud-desktop.git mac-crafter: Check if path to trecursively codesign exists and throw error if it doesn't Signed-off-by: Claudio Cambra --- diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index be7eb586d..4b2341274 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -21,6 +21,7 @@ enum CodeSigningError: Error { } enum AppBundleSigningError: Error { + case doesNotExist(String) case couldNotEnumerate(String) } @@ -64,6 +65,10 @@ func recursivelyCodesign( skip: [String] = [] ) throws { let fm = FileManager.default + guard fm.fileExists(atPath: path) else { + throw AppBundleSigningError.doesNotExist("Item at \(path) does not exist.") + } + guard let pathEnumerator = fm.enumerator(atPath: path) else { throw AppBundleSigningError.couldNotEnumerate( "Failed to enumerate directory at \(path)."